//
//  WZOutCountFrame.m
//  ETong
//
//  Created by wanzhao on 15/11/24.
//  Copyright (c) 2015年 wanzhao. All rights reserved.
//

#import "WZOutCountFrame.h"

#define shijianzhouWidth [UIImage imageNamed:@"outShijianzhou"].size.width

@implementation WZOutCountFrame

- (void)setWzOut:(WZOut *)wzOut
{
    _wzOut = wzOut;
    _outFileFrame = CGRectMake(OppositeWidthRate(6), 0, shijianzhouWidth + 10, 0);
    CGSize maxSize = CGSizeMake(HARDWARE_SCREEN_WIDTH - OppositeWidthRate(50) - shijianzhouWidth + 5, MAXFLOAT);
    
    //计算申请时间的frame
    CGSize timeSize = [wzOut.signTime sizeWithFont:Font12 maxSize:maxSize];
    _outApplyTimeFrame = CGRectMake(CGRectGetMaxX(_outFileFrame) + OppositeWidthRate(20), OppositeHeightRate(10), timeSize.width, timeSize.height);
    
    //计算外出类型Frame
    timeSize = [@"外出签到" sizeWithFont:Font12 maxSize:maxSize];
    _outTypeFrame = CGRectMake(HARDWARE_SCREEN_WIDTH - OppositeWidthRate(15) - timeSize.width, OppositeHeightRate(10), timeSize.width, timeSize.height);
    
    //计算申请公司的frame
    timeSize = [wzOut.customerName sizeWithFont:Font14 maxSize:maxSize];
    _outCompanyFrame = CGRectMake(_outApplyTimeFrame.origin.x, CGRectGetMaxY(_outApplyTimeFrame) + OppositeHeightRate(10), timeSize.width, timeSize.height);
    
    
    //计算申请地址的frame
    timeSize = [[NSString stringWithFormat:@"应签到地址：%@",wzOut.outAddress] sizeWithFont:Font12 maxSize:maxSize];
    _outApplyAddressFrame = CGRectMake(_outApplyTimeFrame.origin.x, CGRectGetMaxY(_outCompanyFrame) + OppositeHeightRate(10), timeSize.width, timeSize.height);
    
    //计算实际签到地址frame
    timeSize = [[NSString stringWithFormat:@"实际签到地址：%@",wzOut.signAddress] sizeWithFont:Font12 maxSize:maxSize];
    _outActualAddressFrame = CGRectMake(_outApplyTimeFrame.origin.x, CGRectGetMaxY(_outApplyAddressFrame) + OppositeHeightRate(5), timeSize.width, timeSize.height);
    
    //计算file的frame
    _outFileFrame = CGRectMake(OppositeWidthRate(15), 0, shijianzhouWidth + 5, CGRectGetMaxY(_outActualAddressFrame) + OppositeHeightRate(10));
    
    //计算cell的高度
    _cellHeight = CGRectGetMaxY(_outFileFrame);
    
}


@end
